from localeurl.templatetags.localeurl_tags import *

register = template.Library()


def change_locale(url, locale):
    """
    Changes the URL's locale prefix if the path is not locale-independent.
    """
    # FIXME: Works only with the "PathPrefixResolver" localeurl resolver
    return chlocale(url, locale, None)

change_locale = stringfilter(change_locale)
register.filter('change_locale', change_locale)